Adding a configuration option to use turbo_submits_with#781
Adding a configuration option to use turbo_submits_with#781pardeyke wants to merge 2 commits intobootstrap-ruby:mainfrom
Conversation
lcreid
left a comment
There was a problem hiding this comment.
Thanks for the PR! This is a very interesting idea.
I think I'd like to keep this out of a configuration option for now. I'm not saying we won't ever use the configuration options to set "defaults", but I think we should be careful that we don't put everything into the configuration options.
It feels to me like, at least for now, we should try to do this with options to the bootstrap_form_* methods, or maybe even just options on the button and primary methods. Along with a helper method to generate the spinner HTML. Don't forget that not everyone will want the same spinner, and that any text is probably going to depend on the end-developer, not the gem. The most obvious example of what I mean is that you would have to allow any text to be localized to other languages.
What do you think? Would you like to try to narrow the scope of your PR to leave the configuration option for a later PR? Let me know if anything was unclear.
Also, don't forget test cases the next time.
Thanks again for this PR. I think you're on to something.
Co-authored-by: Larry Reid <[email protected]>
Add custom content to a submit button while the request is processing.
Try
c.turbo_submits_with = :spinnerto check out the build-in spinner or pass a custom html string.Caveat: Only works on
form.primaryorform.buttonasform.submitrenders ainputfile which only accepts a string and not a html element. Settings this also overridesrender_as_buttononform.primary